package Chapter02;
import java.util.Scanner;
public class zuoye4 {
    //4.输入一个5位整数，求他们每一位上数字的和，并输出
    public static void main(String[] args) {
        Scanner input =new Scanner(System.in);
        int wan,qian,bai,shi,ge,sum;
        System.out.println("请输入一个五位整数:");
        int num =input.nextInt();
        boolean a=num>=10000 && num<100000;
        System.out.println(a);//true:是代表符合五位数,false:是不符合
        wan =num/10000;
        qian =(num/1000)%10;
        bai =(num/100)%10;
        shi =(num/10)%10;
        ge =num%10;
        sum =wan+qian+bai+shi+ge;
        System.out.println("你输入的五位数是:"+num+",相加和是:"+sum);
    }
}
